package com.pi.base.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.pi.base.entity.auto.HomeImg;
import com.pi.base.entity.auto.HomeImgExample;
import com.pi.base.mapper.auto.HomeImgMapper;
import com.pi.base.service.BaseService;
import com.pi.base.service.IHomeImgService;

@Service("homeService")
public class HomeImgService extends BaseService<HomeImg> implements IHomeImgService{

	@Autowired
	private HomeImgMapper homeImgMapper;
	
	@Override
	public List<HomeImg> queryHomeImg(long userid) throws Exception {
		HomeImgExample example = new HomeImgExample();
		example.createCriteria().andBusinessIdEqualTo(userid);
		return homeImgMapper.selectByExample(example);
	}

	@Override
	public void addHomeImg(HomeImg img) throws Exception {
		homeImgMapper.insert(img);		
	}

	@Override
	public void deleteHomeImg(long id) throws Exception {
		homeImgMapper.deleteByPrimaryKey(id);		
	}

	@Override
	public HomeImg getHomeImg(long id) throws Exception {
		return homeImgMapper.selectByPrimaryKey(id);
	}

}
